LIBS_PATH = /home/courses/cse533/Stevens/unpv13e_solaris2.10
#/home/aaithal/unpv13e_linux
#LIBS_PATH = /home/raghu/testsample/Network_Programming/unpv13e

CC = gcc

LIBS = -lresolv -lnsl -lpthread -lsocket\
	-lm ${LIBS_PATH}/libunp.a\
	
FLAGS = -g -O2

CFLAGS = ${FLAGS} -I${LIBS_PATH}/lib

PROGS = client server
# client1 server1 

all: ${PROGS}

client: client.o get_ifi_info_plus.o get_subnet_mask.o rtt.o datagram.o sliding_window.o
	${CC} ${FLAGS} -o client client.o get_ifi_info_plus.o get_subnet_mask.o rtt.o datagram.o sliding_window.o ${LIBS}

client.o: client.c
	${CC} ${CFLAGS} -c client.c 

#dg_send_recv_data: dg_send_recv.o rtt.o
#	${CC} ${FLAGS} -o dg_send_recv_data dg_send_recv.o  rtt.o ${LIBS}

get_subnet_mask.o: get_subnet_mask.c
	${CC} ${CFLAGS} -c get_subnet_mask.c 

	
#client1: client1.o get_ifi_info_plus.o 
#	${CC} ${FLAGS} -o client1 client1.o get_ifi_info_plus.o ${LIBS}
#client1.o: client1.c
#	${CC} ${CFLAGS} -c client1.c 
	
server: server.o get_ifi_info_plus.o sigchldwaitpid.o get_subnet_mask.o\
serverlib.o rtt.o datagram.o congestion.o\
sliding_window.o
	${CC} ${FLAGS} -o server server.o get_ifi_info_plus.o sigchldwaitpid.o\
    get_subnet_mask.o serverlib.o rtt.o datagram.o \
    congestion.o sliding_window.o ${LIBS}

server.o: server.c
	${CC} ${CFLAGS} -c server.c

rtt.o: rtt.c
	${CC} ${CFLAGS} -c rtt.c

serverlib.o: serverlib.c
	${CC} ${CFLAGS} -c serverlib.c 

sliding_window.o: sliding_window.c
	${CC} ${CFLAGS} -c sliding_window.c 

    
#server1: server1.o get_ifi_info_plus.o 
#	${CC} ${FLAGS} -o server1 server1.o get_ifi_info_plus.o  ${LIBS}
#server1.o: server1.c
#	${CC} ${CFLAGS} -c server1.c

datagram.o: datagram.c
	${CC} ${CFLAGS} -c datagram.c 

congestion.o: congestion.c
	${CC} ${CFLAGS} -c congestion.c 

get_ifi_info_plus.o: get_ifi_info_plus.c
	${CC} ${CFLAGS} -c get_ifi_info_plus.c	
	
sigchldwaitpid.o: ${LIBS_PATH}/tcpcliserv/sigchldwaitpid.c
	${CC} ${CFLAGS} -c ${LIBS_PATH}/tcpcliserv/sigchldwaitpid.c

clean:
	rm client server *.o 
#    client1 server1
